home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Collection of Tools & Utilities
/
Collection of Tools and Utilities.iso
/
tex
/
itrns211.zip
/
SRC
/
ITRANS.H
< prev
next >
Wrap
C/C++ Source or Header
|
1991-11-28
|
13KB
|
397 lines
#ifndef ITRANS_H
#define ITRANS_H
/*
*==========================================================================
* Copyright 1991 Avinash Chopde, All Rights Reserved.
*
* Permission to use, copy, modify and distribute this software and its
* documentation for any purpose is hereby granted without fee, provided that
* the above copyright notice appear in all copies and that both that
* copyright notice and this permission notice appear in supporting
* documentation, and that the name of Avinash Chopde not be used in
* advertising or publicity pertaining to distribution of the software
* without specific, written prior permission.
* Avinash Chopde makes no representations about the suitability of this
* software for any purpose.
* It is provided "as is" without express or implied warranty.
*
* AVINASH CHOPDE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS,
* IN NO EVENT SHALL AVINASH CHOPDE BE LIABLE FOR ANY SPECIAL, INDIRECT OR
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
* OF THIS SOFTWARE.
*
* Author: Avinash Chopde, 1991
* C2 Colonial Drive #4, Andover, MA 01810, USA.
*
*/
/* static char S_RCSID[] = "$Header: e:/itrans/src/rcs/itrans.h 1.10 91/11/28 20:38:42 avinash Exp $"; */
#include <stdio.h>
#include "../version.h"
#if defined(MSDOS) || defined(sgi)
/* actually, should be included in more places, but many systems
* are still missing this file...
*/
#include "stdlib.h"
#endif
#ifdef SYSV
#include <string.h>
#else
#include <strings.h>
#endif
#ifdef sgi
#include <malloc.h>
#endif
#if defined(__STDC__) || (PROTO_C)
# define P(s) s
#else
# define P(s) ()
#endif
#include <ctype.h>
#define YYDEBUG 1
#include "imap.h"
#ifdef MSDOS
# define PATHSEP ';'
# define DIRSEP '\\'
# define PATH_MAX 256
#else
# include <pwd.h>
# define PATHSEP ':'
# define DIRSEP '/'
# define PATH_MAX 1024
#endif
/* CONVWORD_LEN is the number of characters that will be generated
* (in TeX or in PostScript) when a single input word is converted
* Should be large enough to handle the verbose TeX commands,
* long words in indian languages....
*/
#define CONVWORD_LEN 8192
/* somewhere between Jan-July 1991, the first version of this
* software came out.
* Supported Devnagari only, under hindi/marathi switches.
*/
/* environment variable for all the paths to search for input file.. */
#define ITRANS_PATH "ITRANSPATH"
#ifdef MSDOS
#define ITRANS_PATH_DEF "ITRANSPATH=;..\\lib;"
#else
#define ITRANS_PATH_DEF "ITRANSPATH=:../lib:"
#endif
/* the default ifm file to use --- assume devanagari input */
#define DEVN_IFM_FILE "dvnc.ifm"
#define FALSE 0
#define TRUE 1
#define NAMELEN 1024
#define LANGS_MAX (ENDLANG_TOK - ILANG_TOK)
#define FONTS_MAX (LANGS_MAX + 3)
#define LINELEN 1024
/* max input line len - AFM, IFM files, mainly */
#define VOWEL_TYPE 1
#define CONSONANT_SINGLE_TYPE 2
#define CONSONANT_DOUBLE_TYPE 3
#define SPECIAL_TYPE 4
#define CONSONANT_MANY_TYPE 100
#define CONS_MAX 10
/* maximum number of (half) consonants allowed.
* each indian language letter is either a vowel or a
* list of half consonants followed by a vowel.
*/
#define _I_(ANY_TOK) ((ANY_TOK)-OFFSET_TOK)
/* _I_ converts a token from the parser to its index in
* the 'font_t.enc[_I_()]' array.
*/
#define _F_(ANY_TOK) ((ANY_TOK)-OFFSET_TOK)
/* _F_ converts a token from the parser to its form in
* the 'font_t.khadi[someconsonant][_F_()]' array.
* Note that forms exist only for A_TOK to AHA_TOK.
* (additional forms exist, such as HALF_FORM which
* have no corresponding parser token)
*/
#define A_FORM (_F_(A_TOK))
#define AA_FORM (_F_(AA_TOK))
#define I_FORM (_F_(I_TOK))
#define II_FORM (_F_(II_TOK))
#define U_FORM (_F_(U_TOK))
#define UU_FORM (_F_(UU_TOK))
#define RI_FORM (_F_(RI_TOK))
#define RII_FORM (_F_(RII_TOK))
#define LI_FORM (_F_(LI_TOK))
#define LII_FORM (_F_(LII_TOK))
#define AY_FORM (_F_(AY_TOK))
#define AAY_FORM (_F_(AAY_TOK))
#define AI_FORM (_F_(AI_TOK))
#define O_FORM (_F_(O_TOK))
#define OO_FORM (_F_(OO_TOK))
#define AU_FORM (_F_(AU_TOK))
#define AM_FORM (_F_(AM_TOK))
#define AHA_FORM (_F_(AHA_TOK))
#define HALF_FORM (AHA_FORM + 1)
#define IMPLICIT_FORM (AHA_FORM + 2)
#define NUMFORMS (AHA_FORM + 3)
/* =================================================================== */
/* PostScript Stuff */
/* EMSIZE will be the current font size
* EM converts given em size to PostScript point size
*/
#define EMSIZE "EMSIZE"
#define EMTOPS "EM"
/* =================================================================== */
/* TeX Stuff */
/* nothing yet */
/* =================================================================== */
/* LETTER_T */
/* Used to pass info from the parser to the application routine */
typedef struct {
int type; /* type - vowel, consonant, or
* half consonant and another consonant
*/
int cons[CONS_MAX];
char nolig[CONS_MAX];
/* normally, cons[i] and cons[i+1] are checked
* for ligatures, and if one exists, it is used.
* But, if nolig[i] is TRUE, then no check
* is made for ligatures, cons[i] is printed
* using its half form.
* Naturally, this only applies if n >= 2
*/
int n; /* number of consonants in cons */
int v; /* vowel that goes with c1 or c2 - or is standalone */
} letter_t;
/* =================================================================== */
/* PSCHAR_T */
typedef struct {
/* all units are for a 1 point size char, times 1000 */
int w; /* char width */
int llx, lly, urx, ury; /* bounding box */
} pschar_t;
/* =================================================================== */
/* COMP_UNIT_T */
/* Each Devnagari Character is a Composite Character.
* Each composite character is a list of <pcode, deltas> that
* specify printer the given postscript char pcode, at the given delta.
* pcode may be IMPLICIT_PSCHAR, implying that this composite char
* is a complex char (ex: half sa, half ta, yee), and need to get the
* implicit form the the char.
* Implicit forms of single chars are directly defined, for multiple
* forms (as in the above given example) need to compose together
* all half/implicit forms of the complex char.
*/
#define IMPLICIT_PSCHAR -1
#define NO_PSCHAR -2
#define DORG_LL 1
#define DORG_CLR 2
/* the deltas in comp_unit_t may be specied with
* respect to the current char origin (DORG_LL), or wrt to the
* next char origin (DORG_CLR - current-lower-right)
*/
typedef struct __comp_unit_t {
int u_pschar; /* the postscript character code */
/* may be IMPLICIT_PSCHAR, implies that the entire
* implicit letter has to be printed out at this
* point.
*/
int deltax, deltay; /* The offset that is to be used
* to print this character.
* The offset is wrt to the current position,
* depends on the value of the variable dorg.
* (UNLIKE Adobe's Composite Character
* defn which is always from char origin)
* The delta's refer to a char 1 point
* in size, and the delta's are x1000.
* If u_pschar == NO_PSCHAR, then
* no char is printed, just this delta
* is applied.
*/
int dorg; /* specifies whether the offset is wrt current pos
* or wrt the origin of the character.
* Is usually DORG_CLR, i.e current pos.
*/
struct __comp_unit_t* next; /* pointer to the next comp_unit.. */
} comp_unit_t;
int cus_to_ps P((comp_unit_t* cus, /* chain of PostScript Chars to output */
int fsize, /* font size being used for the chars */
char pscomm[])); /* the postscript commands returned here */
int cus_to_tex P((comp_unit_t* cus, /* chai